using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableSalesType
	{
		public const string Table = "SalesType";
		public const string SalesTypeID = "SalesTypeID";
		public const string SalesTypeName = "SalesTypeName";
		public const string Description = "Description";
	}
	
	[Serializable]
	public class BaseSalesType
		: IDbSessionEntity, IJsonClass
	{
		int m_SalesTypeID;
		/// <summary>
        /// 
        /// </summary>
        public int SalesTypeID
        {
            get { return m_SalesTypeID; }
            set { m_SalesTypeID = value; }
        }
		
		string m_SalesTypeName;
		/// <summary>
        /// 
        /// </summary>
        public string SalesTypeName
        {
            get { return m_SalesTypeName; }
            set { m_SalesTypeName = value; }
        }
		
		string m_Description;
		/// <summary>
        /// 
        /// </summary>
        public string Description
        {
            get { return m_Description; }
            set { m_Description = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_SalesTypeID = reader[TableSalesType.SalesTypeID];
            m_SalesTypeName = reader[TableSalesType.SalesTypeName];
            m_Description = reader[TableSalesType.Description];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableSalesType.SalesTypeID, PrimaryKeyType.Identity, SalesTypeID);
			writer[TableSalesType.SalesTypeName] = SalesTypeName;
			writer[TableSalesType.Description] = Description;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_SalesTypeID = idd;
        }
		
		public string TableName
        {
            get { return TableSalesType.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_SalesTypeID = hashToRead["SalesTypeID"];
			 
             m_SalesTypeName = hashToRead["SalesTypeName"];
			 
             m_Description = hashToRead["Description"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["SalesTypeID"] = SalesTypeID;
			 
            hashToFill["SalesTypeName"] = SalesTypeName;
			 
            hashToFill["Description"] = Description;
			 
        }

        #endregion
		
	}
}
